cmake_minimum_required(VERSION 3.8)
project(action_01)

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
  add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(rclcpp REQUIRED)
find_package(rclcpp_action REQUIRED)
find_package(example_interfaces REQUIRED)
find_package(action_interface REQUIRED)

if(BUILD_TESTING)
  find_package(ament_lint_auto REQUIRED)
  # the following line skips the linter which checks for copyrights
  # comment the line when a copyright and license is added to all source files
  set(ament_cmake_copyright_FOUND TRUE)
  # the following line skips cpplint (only works in a git repo)
  # comment the line when this package is in a git repo and when
  # a copyright and license is added to all source files
  set(ament_cmake_cpplint_FOUND TRUE)
  ament_lint_auto_find_test_dependencies()
endif()

#robot_01
add_executable(robot_01 
  src/robot_01.cpp
  src/robot.cpp)
target_include_directories(robot_01 PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>)
target_compile_features(robot_01 PUBLIC c_std_99 cxx_std_17)  # Require C99 and C++17
ament_target_dependencies(robot_01
  "rclcpp"
  "rclcpp_action"
  "example_interfaces"
  "action_interface")

install(TARGETS 
  robot_01
  DESTINATION lib/${PROJECT_NAME})

#robot_slow
add_executable(robot_slow 
  src/robot_slow.cpp
  src/robot.cpp)
target_include_directories(robot_slow PUBLIC
  $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
  $<INSTALL_INTERFACE:include>)
target_compile_features(robot_slow PUBLIC c_std_99 cxx_std_17)  # Require C99 and C++17
ament_target_dependencies(robot_slow
  "rclcpp"
  "rclcpp_action"
  "example_interfaces"
  "action_interface")

install(TARGETS 
robot_slow
  DESTINATION lib/${PROJECT_NAME})

#robot_control_01
add_executable(robot_control_01
  src/robot_control_01.cpp
)
target_include_directories(robot_control_01 PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
target_compile_features(robot_control_01 PUBLIC c_std_99 cxx_std_17)  # Require C99 and C++17
ament_target_dependencies(
  robot_control_01
  "rclcpp"
  "rclcpp_action"
  "action_interface"
  "example_interfaces"
)

install(TARGETS robot_control_01
DESTINATION lib/${PROJECT_NAME})

add_executable(async_client_exec "src/async_client.cpp")
target_include_directories(async_client_exec PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>)
ament_target_dependencies(
  async_client_exec
  "rclcpp"
  "rclcpp_action"
  "action_interface"
)

install(TARGETS async_client_exec
DESTINATION lib/${PROJECT_NAME})

ament_package()
